package com.aaa.service;

import com.aaa.dao.EmpDao;
import com.aaa.entity.Emp;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class EmpService {
    @Resource
    private EmpDao empDao;
    public Result select(Integer count,Integer pageSize){
        IPage<Emp> page = new Page(count,pageSize);
        IPage<Emp> empIPage = empDao.selectPage(page, null);
    return new Result(200,"查询数据成功",empIPage);
    }
    public Result insert(Emp emp){
        int insert = empDao.insert(emp);
        return new Result(200,"添加成功",insert);
    }
    public Result delete(int id){
        int i = empDao.deleteById(id);
        return new Result(200,"根据id删除成功",i);
    }
    public Result update(Emp emp){
        int i = empDao.updateById(emp);
        return new Result(200,"根据id修改成功",i);
    }
}
